export default {
  /*-----------------用户信息-----------------*/
  RESET_STATE: (state) => {
    // Object.assign(state, getDefaultState())
  },
  SET_TOKEN: (state, token) => {
    state.userInfo.token = token
  },
  SET_NAME: (state, name) => {
    state.userInfo.userName = name
  },
  SET_AVATAR: (state, avatar) => {
    state.userAvatar = avatar
  },
  /*-----------------设置-----------------*/
  CHANGE_SETTING: (state, { key, value }) => {
    // eslint-disable-next-line no-prototype-builtins
    if (state.hasOwnProperty(key)) {
      state[key] = value
    }
  },
  CHANGE_THEME: (state, themeClass) => {
    state.settings.themeClass = themeClass
  },
  /*-----------------app-----------------*/
  //转换菜单折叠状态
  TOGGLE_SIDEBAR: state => {
    state.sidebar.opened = !state.sidebar.opened
    state.sidebar.withoutAnimation = false
    // if (state.sidebar.opened) {
    //   Cookies.set('sidebarStatus', 1)
    // } else {
    //   Cookies.set('sidebarStatus', 0)
    // }
  },
  CLOSE_SIDEBAR: (state, withoutAnimation) => {
    // Cookies.set('sidebarStatus', 0)
    state.sidebar.opened = false
    state.sidebar.withoutAnimation = withoutAnimation
  },
  TOGGLE_DEVICE: (state, device) => {
    state.device = device
  }
}
